import React, {Component} from 'react';
import styles from './Mine.less'
import Card from "../components/card";
import isEmpty from 'lodash/isEmpty'
import { connect } from 'dva';
import {GET_MYCOURSE_DETAIL} from '../../../actions/course';

@connect(({ course }) => ({
  course
}))

class Mine extends Component{
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    const {dispatch} = this.props
    dispatch(GET_MYCOURSE_DETAIL())
  }

  render() {
    const {course: { myCourseList }} = this.props
    return (
      <div style={{paddingBottom: 146}} className={styles.courseContainer}>
        {
          !isEmpty(myCourseList) && myCourseList.map((course, courseIndex) => {
            return <Card cardInfo={course} index={courseIndex} key={course.id}/>
          })
        }
      </div>
    );
  }
}



export default Mine
